<template>
  <t-layout id="app">
    <!-- 顶部菜单栏 -->
    <app-header />
    <!-- 主页面 -->
    <t-layout id="main">
      <app-side />
      <!-- 内容-->
      <t-content class="relative">
        <router-view />
      </t-content>
    </t-layout>
  </t-layout>
  <!-- 索引管理 -->
  <index-manage />
</template>

<script lang="ts" setup>
// 枚举
import PageNameEnum from "@/enumeration/PageNameEnum";
// 工具类
import { versionManager, VersionStatus } from "@/components/version-manager";
import { showVersionUpdateDialog } from "@/module/version-update";
import { checkElectronUpdate } from "@/components/version-manager/ElectronUpdate";
// 布局
import AppHeader from "@/module/layout/app-header/index.vue";
import AppSide from "@/module/layout/app-sider/index.vue";

const router = useRouter();

const IndexManage = defineAsyncComponent(() => import("@/module/index-manage/index.vue"));

// 初始化数据
onMounted(() => {
  console.log("初始化完成");
  // 版本
  switch (versionManager()) {
    case VersionStatus.NEW:
      router.push(PageNameEnum.MORE_ABOUT);
      break;
    case VersionStatus.UPDATE:
      showVersionUpdateDialog();
      router.push(PageNameEnum.MORE_UPDATE);
      break;
  }
  checkElectronUpdate();
});
// 初始化主题
</script>

<style lang="less">
#app {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--td-bg-color-container);
  color: var(--td-text-color-primary);
}

#main {
  position: fixed;
  top: 40px;
  left: 0;
  width: 100vw;
  height: calc(100vh - 40px);
  overflow: hidden;
}
.app-feedback {
  width: calc(100vw - 40px);
  height: calc(100vh - 58px - 60px);
  border: none;
}
</style>
